/*
 * @Author: 李环玉 834654733@qq.com
 * @Date: 2023-11-25 19:03:33
 * @LastEditors: 李环玉 834654733@qq.com
 * @LastEditTime: 2023-12-16 18:59:22
 * @FilePath: \koa-server\src\utils\response.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
class ResponseFormat {
  success(ctx,data,message = '处理成功',code = 200,boj){
    ctx.body = {
      code,
      message,
      data,
      ...boj
    }
  }
  error(ctx,data = null,message = '系统错误',code = 500){
    ctx.body = {
      code,
      message:JSON.stringify(message),
      data
    }
  }
}
module.exports = new ResponseFormat()